package com.example.demo.component.proxy.cglib.callback;

import net.sf.cglib.proxy.CallbackFilter;

import java.lang.reflect.Method;

/**
 * @ClassName ConcreteClassCallbackFilter
 * @Description
 * @date 2023/4/6 13:51
 * @Author yanceysong
 * @Version 1.0
 */
public class ConcreteClassCallbackFilter implements CallbackFilter {
    public int accept(Method method) {
        switch (method.getName()) {
            case "getConcreteMethodB":
                return 0;//Callback callbacks[0]
            case "getConcreteMethodA":
                return 1;//Callback callbacks[1]
            case "getConcreteMethodFixedValue":
                return 2;//Callback callbacks[2]
        }
        return 1;
    }
}
